<div class="main clearfix">
	<?php $this->load->view('frontend/lastnewshot'); ?>
	<div class="main_inner">

		<div class="group_post">
			<?php $category = $this->category_model->get(2); ?>
			<div class="group_category gioitre">
				<div class="title_category clearfix">
					<h2><a href="<?= siteUrl('post/index/'.$category->id) ?>"><?= $category->title ?></a></h2>
					<div class="title_subcategories">
						<?php foreach($category->child as $child_id):
							$child = $this->category_model->get($child_id); ?>
							<h3><a href="<?= siteUrl('post/index/'.$child->id) ?>"><?= $child->title ?></a></h3>
						<?php endforeach ?>
					</div>
				</div><!-- End title !-->
				<div class="postItems clearfix">
				<?php
					$child_ids = array($category->id);
					$child_ids = array_merge($child_ids, $category->child);
		
					$this->post_model->list_where = 'type != 2 AND published = 1 AND category_id IN ( '.implode(', ', $child_ids).' )';
					$items = $this->post_model->getList(9);
					foreach($items as $k=>$itm):
						if($k) break;
						$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
				?>
						<div class="big_item">
							<div class="postImage">
								<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 391, 293) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
							</div>
							<div class="postText">
								<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
								<div class="postDescription"><?= word_limiter($itm->description, 15) ?></div>
							</div>
						</div>
				<?php endforeach ?>
					<div class="more_items">
						<?php
							foreach($items as $k=>$itm):
								if($k>3) break;
								$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
								if($k>0 && $k<=3):
						?>
								<div class="item">
									<div class="postImage">
										<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 188, 141) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
									</div>
									<div class="postText">
										<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
									</div>
								</div>
							<?php
								endif;
							endforeach;
						?>
						<div class="clr"></div>
						<ul class="more_items_link">
						<?php
							foreach($items as $k=>$itm):
								$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
								if($k>3):
						?>
							<li><a href="<?= $link ?>"><?= $itm->title ?></a></li>
						<?php
								endif;
							endforeach;
						?>
						</ul>
					</div>
				</div>
			</div><!-- group_category gioitre !-->

			<?php $category = $this->category_model->get(1); ?>
			<div class="group_category giaitri">
				<div class="title_category clearfix">
					<h2><a href="<?= siteUrl('post/index/'.$category->id) ?>"><?= $category->title ?></a></h2>
					<div class="title_subcategories">
						<?php foreach($category->child as $child_id):
							$child = $this->category_model->get($child_id); ?>
							<h3><a href="<?= siteUrl('post/index/'.$child->id) ?>"><?= $child->title ?></a></h3>
						<?php endforeach ?>
					</div>
				</div><!-- End title !-->
				<div class="postItems clearfix">
					<?php
						$child_ids = array($category->id);
						$child_ids = array_merge($child_ids, $category->child);

						$this->post_model->list_where = 'type != 2 AND published = 1 AND category_id IN ( '.implode(', ', $child_ids).' )';
						$items = $this->post_model->getList(4);
						foreach($items as $k=>$itm):
							if($k) break;
							$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
					?>
						<div class="big_item">
							<div class="postImage">
								<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 391, 293) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
								<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
							</div>
							<div class="postDescription"><?= $itm->title ?></div>
						</div>
					<?php endforeach ?>
					<div class="more_items">
					<?php
						foreach($items as $k=>$itm):
							$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
							if($k>0):
					?>
							<div class="item clearfix">
								<div class="postImage">
									<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 391, 293) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
								</div>
								<div class="postText">
									<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
									<div class="postDescription"><?= word_limiter($itm->description, 12) ?></div>
								</div>
							</div>
					<?php
							endif;
						endforeach;
					?>
					</div>
				</div>
			</div><!-- group_category giaitri !-->

			<?php $category = $this->category_model->get(3); ?>
			<div class="group_category contrai">
				<div class="title_category clearfix">
					<h2><a href="<?= siteUrl('post/index/'.$category->id) ?>"><?= $category->title ?></a></h2>
					<div class="title_subcategories">
						<?php foreach($category->child as $child_id):
							$child = $this->category_model->get($child_id); ?>
							<h3><a href="<?= siteUrl('post/index/'.$child->id) ?>"><?= $child->title ?></a></h3>
						<?php endforeach ?>
					</div>
				</div><!-- End title !-->
				<div class="postItems clearfix">
					<?php
						$child_ids = array($category->id);
						$child_ids = array_merge($child_ids, $category->child);

						$this->post_model->list_where = 'type != 2 AND published = 1 AND category_id IN ( '.implode(', ', $child_ids).' )';
						$items = $this->post_model->getList(7);
						foreach($items as $k=>$itm):
							if($k) break;
							$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
					?>
						<div class="big_item">
							<div class="postImage">
								<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 391, 293) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
							</div>
							<div class="postText">
								<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
								<div class="postDescription"><?= word_limiter($itm->description, 18) ?></div>
							</div>
						</div>
					<?php
						endforeach;
					?>
					<div class="more_items">
					<?php
						foreach($items as $k=>$itm):
							$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
							if($k>0):
					?>
							<div class="item clearfix">
								<div class="postImage">
									<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 188, 141) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
								</div>
								<div class="postText">
									<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
								</div>
							</div>
					<?php
							endif;
						endforeach;
					?>
					</div>
				</div>
			</div><!-- group_category contrai !-->

			<?php $category = $this->category_model->get(4); ?>
			<div class="group_category congai">
				<div class="title_category clearfix">
					<h2><a href="<?= siteUrl('post/index/'.$category->id) ?>"><?= $category->title ?></a></h2>
					<div class="title_subcategories">
						<?php foreach($category->child as $child_id):
							$child = $this->category_model->get($child_id); ?>
							<h3><a href="<?= siteUrl('post/index/'.$child->id) ?>"><?= $child->title ?></a></h3>
						<?php endforeach ?>
					</div>
				</div><!-- End title !-->
				<div class="postItems clearfix">
					<?php
						$child_ids = array($category->id);
						$child_ids = array_merge($child_ids, $category->child);

						$this->post_model->list_where = 'type != 2 AND published = 1 AND category_id IN ( '.implode(', ', $child_ids).' )';
						$items = $this->post_model->getList(3);
						foreach($items as $k=>$itm):
							if($k) break;
							$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
					?>
						<div class="big_item">
							<div class="postImage">
								<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 391, 293) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
							</div>
							<div class="postText">
								<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
								<div class="postDescription"><?= word_limiter($itm->description, 18) ?></div>
							</div>
						</div>
					<?php
						endforeach;
					?>
					<div class="more_items">
					<?php
						foreach($items as $k=>$itm):
							$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
							if($k>0):
					?>
							<div class="item clearfix">
								<div class="postImage">
									<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 188, 141) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
								</div>
								<div class="postText">
									<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
								</div>
							</div>
					<?php
							endif;
						endforeach;
					?>
					</div>
				</div>
			</div><!-- group_category congai !-->

			<?php $category = $this->category_model->get(5); ?>
			<div class="group_category goctraitim">
				<div class="title_category clearfix">
					<h2><a href="<?= siteUrl('post/index/'.$category->id) ?>"><?= $category->title ?></a></h2>
					<div class="title_subcategories">
						<?php foreach($category->child as $child_id):
							$child = $this->category_model->get($child_id); ?>
							<h3><a href="<?= siteUrl('post/index/'.$child->id) ?>"><?= $child->title ?></a></h3>
						<?php endforeach ?>
					</div>
				</div><!-- End title !-->
				<div class="postItems clearfix">
					<?php
						$child_ids = array($category->id);
						$child_ids = array_merge($child_ids, $category->child);

						$this->post_model->list_where = 'type != 2 AND published = 1 AND category_id IN ( '.implode(', ', $child_ids).' )';
						$items = $this->post_model->getList(8);
						foreach($items as $k=>$itm):
							$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
							if($k) break;
					?>
						<div class="big_item">
							<div class="postImage">
								<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 391, 293) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
							</div>
							<div class="postText">
								<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
								<div class="postDescription"><?= word_limiter($itm->description, 18) ?></div>
							</div>
						</div>
					<?php
						endforeach;
					?>
					<div class="more_items">
						<?php
							foreach($items as $k=>$itm):
								if($k>3) break;
								$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
								if($k>0 && $k<=3):
						?>
								<div class="item">
									<div class="postImage">
										<a href="<?= $link ?>"><img alt="<?= html_escape($itm->title) ?>" src="<?= thumb($itm->image, 188, 141) ?>" alt="<?= html_escape($itm->title) ?>" /></a>
									</div>
									<div class="postText">
										<h4><a href="<?= $link ?>"><?= $itm->title ?></a></h4>
									</div>
								</div>
							<?php
								endif;
							endforeach;
						?>
						<div class="clr"></div>
						<ul class="more_items_link">
						<?php
							foreach($items as $k=>$itm):
								$link = siteUrl('post/detail/'.$itm->id.'-'.$itm->alias, $itm->category_id);
								if($k>3):
						?>
							<li><a href="<?= $link ?>"><?= $itm->title ?></a></li>
						<?php
								endif;
							endforeach;
						?>
						</ul>
					</div>
				</div>
			</div><!-- group_category goctraitim !-->
		</div><!-- group_post -->

	</div><!-- main_inner -->
	<div class="right">
		<?php $this->load->view('frontend/sitebar'); ?>
	</div><!-- right -->
</div><!-- main -->